#!/usr/bin/python
# -*- coding: UTF-8 -*-
import matplotlib.pyplot as plot
import numpy as np
import matplotlib.patches as patch

fig,ax=plot.subplots()
#cicyle
xy1=np.array([0.2,0.2])
cycle=patch.Circle(xy1,0.05)
plot.grid()
ax.add_patch(cycle)

#长方形,左下角
xy2=np.array([0.2,0.8])
rect=patch.Rectangle(xy2,0.2,0.1,color="r")
ax.add_patch(rect)

#多边形,第二个参数 变型
xy3=np.array([0.8,0.2])
plog=patch.RegularPolygon(xy3,6,0.1,color="b")
ax.add_patch(plog)

#椭圆
xy4=np.array([0.8,0.8])
elipse=patch.Ellipse(xy4,0.4,0.2,color="g")
ax.add_patch(elipse)

#调整xy坐标轴的比例,防止圆变成椭圆
plot.axis("equal")
plot.show()